package com.xianbeiying.app.ckgl.util;

import android.content.Context;

import com.xianbeiying.app.ckgl.bean.EZdBean;
import com.xianbeiying.app.ckgl.bean.EZqBean;
import com.xianbeiying.app.ckgl.bean.FaMenBean;
import com.xianbeiying.app.ckgl.bean.FameZqBean;
import com.xianbeiying.app.ckgl.bean.QueZDBean;
import com.xianbeiying.app.ckgl.bean.QueZQBean;
import com.xianbeiying.app.ckgl.bean.SysConfigBean;
import com.xianbeiying.app.ckgl.bean.SysConfigssBean;
import com.xianbeiying.app.ckgl.bean.SystemConfigBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 设备模块
 */
public class DeviceUtil {

    /**
     * 输入框内容的判断
     */
    public static boolean isInputNull(Context context, String starttime, String enttime, String etsc, String etzq) {
        boolean input = true;
        if (starttime.isEmpty()) {
            ToastUtil.showInfo(context, "请选择开始时间");
            input = false;
            return input;
        }
        if (enttime.isEmpty()) {
            ToastUtil.showInfo(context, "请选择结束时间");
            input = false;
            return input;
        }
//        if (etsc.contains("-")){
//            ToastUtil.showInfo(context, "结束时间不能小于开始时间");
//            input = false;
//            return input;
//        }
        if (etsc.isEmpty()) {
            ToastUtil.showInfo(context, "请输入时长");
            input = false;
            return input;
        }
        if (etsc.equals("0")) {
            ToastUtil.showInfo(context, "请输入正确的时长");
            input = false;
            return input;
        }
        //判断时长合理
        if (!isScHl(starttime, enttime, etsc)) {
            ToastUtil.showInfo(context, "时长输入有误,没有在合理区间内");
            input = false;
            return input;

        }
        if (etzq.isEmpty()) {
            ToastUtil.showInfo(context, "请输入天数");
            input = false;
            return input;
        }
        if (etzq.equals("0")) {
            ToastUtil.showInfo(context, "请输入正确的天数");
            input = false;
            return input;
        }
        //判断周期是否合理
        if (!isZqHl(starttime, enttime, etzq)) {
            ToastUtil.showInfo(context, "周期输入有误,没有在合理区间内");
            input = false;
            return input;

        }
        return input;
    }

    public static boolean isInputTimeNull(Context context, String yearss, String months, String days, String hhs, String mms) {
        boolean inputTime = true;
        if (yearss.isEmpty()) {
            ToastUtil.showInfo(context, "请选择年份");
            inputTime = false;
            return inputTime;
        }
        if (months.isEmpty()) {
            ToastUtil.showInfo(context, "请选择月份");
            inputTime = false;
            return inputTime;
        }
        if (days.isEmpty()) {
            ToastUtil.showInfo(context, "请选择日期");
            inputTime = false;
            return inputTime;
        }
        if (hhs.isEmpty()) {
            ToastUtil.showInfo(context, "请选择小时");
            inputTime = false;
            return inputTime;
        }
        if (mms.isEmpty()) {
            ToastUtil.showInfo(context, "请选择分钟");
            inputTime = false;
            return inputTime;
        }
        return inputTime;
    }

    public static boolean isInputContent(Context context, String sdx, String sds, String etsc, String type) {
        boolean inpout = true;
        if (type.equals("除湿器")){
            inpout=isffInputContent(context,sdx,sds,etsc);
        }
        if (type.equals("风机")){
            inpout=issfInputContent(context,sdx,sds,etsc);
        }
        if (type.equals("加热器")){
            inpout=issInputContent(context,sdx,sds,etsc);
        }
    return inpout;
    }

    public static boolean isffInputContent(Context context, String sdx, String sds, String etsc) {
        boolean inpout = true;
        if (sdx.isEmpty()) {
            ToastUtil.showInfo(context, "请输入土壤湿度下限");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sdx) < 0 || Integer.valueOf(sdx) > 100) {
            ToastUtil.showInfo(context, "土壤湿度范围在0到100之间");
            inpout = false;
            return inpout;
        }
        if (sds.isEmpty()) {
            ToastUtil.showInfo(context, "请输入土壤湿度上限");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sds) < 0 || Integer.valueOf(sds) > 100) {
            ToastUtil.showInfo(context, "土壤湿度范围在0到100之间");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sdx) >= Integer.valueOf(sds)) {
            ToastUtil.showInfo(context, "土壤下限湿度不能大于上限湿度");
            inpout = false;
            return inpout;
        }
        if (etsc.isEmpty()) {
            ToastUtil.showInfo(context, "时长不能为空");
            inpout = false;
            return inpout;
        }
        if (etsc.equals("0")) {
            ToastUtil.showInfo(context, "时长输入不正确");
            inpout = false;
            return inpout;
        }
        return inpout;
    }

    public static boolean issfInputContent(Context context, String sdx, String sds, String etsc) {
        boolean inpout = true;
        if (sdx.isEmpty()) {
            ToastUtil.showInfo(context, "请输入温度下限");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sdx) < 0 || Integer.valueOf(sdx) > 100) {
            ToastUtil.showInfo(context, "温度范围在0到100之间");
            inpout = false;
            return inpout;
        }
        if (sds.isEmpty()) {
            ToastUtil.showInfo(context, "请输入温度上限");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sds) < 0 || Integer.valueOf(sds) > 100) {
            ToastUtil.showInfo(context, "温度范围在0到100之间");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sdx) >= Integer.valueOf(sds)) {
            ToastUtil.showInfo(context, "下限温度不能大于上限温度");
            inpout = false;
            return inpout;
        }
        if (etsc.isEmpty()) {
            ToastUtil.showInfo(context, "时长不能为空");
            inpout = false;
            return inpout;
        }
        if (etsc.equals("0")) {
            ToastUtil.showInfo(context, "时长输入不正确");
            inpout = false;
            return inpout;
        }
        return inpout;
    }

    public static boolean issInputContent(Context context, String sdx, String sds, String etsc) {
        boolean inpout = true;
        if (sdx.isEmpty()) {
            ToastUtil.showInfo(context, "请输入空气温度下限");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sdx) < -10 || Integer.valueOf(sdx) > 50) {
            ToastUtil.showInfo(context, "空气温度范围在-10到50之间");
            inpout = false;
            return inpout;
        }
        if (sds.isEmpty()) {
            ToastUtil.showInfo(context, "请输入空气温度上限");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sds) < 0 || Integer.valueOf(sds) > 50) {
            ToastUtil.showInfo(context, "空气温度范围在10到50之间");
            inpout = false;
            return inpout;
        }
        if (Integer.valueOf(sdx) >= Integer.valueOf(sds)) {
            ToastUtil.showInfo(context, "下限空气温度不能大于上限空气温度");
            inpout = false;
            return inpout;
        }
        if (etsc.isEmpty()) {
            ToastUtil.showInfo(context, "时长不能为空");
            inpout = false;
            return inpout;
        }
        if (etsc.equals("0")) {
            ToastUtil.showInfo(context, "时长输入不正确");
            inpout = false;
            return inpout;
        }
        return inpout;
    }

    //判断此按钮是否被选择
    public static boolean isButtonSelect(Context context, ArrayList<Boolean> arrayList, int posttion) {
        boolean isSelect = false;
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            if (arrayList.get(posttion)) {
                isSelect = true;
                ToastUtil.showInfo(context, "此除湿器已在分组中");
                return isSelect;
            }
        }
        return isSelect;
    }

    /**
     * 周期获取所有的组id
     */
    private static ArrayList<String> getBeanGROUPID(QueZQBean queZQBean) {
        ArrayList<String> gROUPID = new ArrayList<>();
        gROUPID.clear();
        int size = queZQBean.getV().getPLANS().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                gROUPID.add(queZQBean.getV().getPLANS().get(i).getGROUPID());
            }
        }
        return com.xianbeiying.app.ckgl.data.DataUtil.getRListData(gROUPID);
    }

    /**
     * 自动获取所有的组id
     */
    private static ArrayList<String> getZdBeanGROUPID(QueZDBean queZDBean) {
        ArrayList<String> gROUPID = new ArrayList<>();
        gROUPID.clear();
        int size = queZDBean.getV().getPLANS().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                gROUPID.add(queZDBean.getV().getPLANS().get(i).getGROUPID());
            }
        }
        return com.xianbeiying.app.ckgl.data.DataUtil.getRListData(gROUPID);
    }

    /**
     * 周期或者自动获取所有的组id
     */
    private static ArrayList<String> getArrayGROUPID(ArrayList<FameZqBean> arrayList) {
        ArrayList<String> gROUPID = new ArrayList<>();
        gROUPID.clear();
        int size = arrayList.size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                gROUPID.add(arrayList.get(i).getGROUPID() + "");
            }
        }
        return com.xianbeiying.app.ckgl.data.DataUtil.getRListData(gROUPID);
    }

    /**
     * 周期遍历数据
     */
    public static List<EZqBean> getBeanZqBean(QueZQBean queZQBean, ArrayList<FaMenBean.VBean.STATUSBean> listFa) {
        List<EZqBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = queZQBean.getV().getPLANS().size();
        int sebieSize = listFa.size();
        if (size != 0) {
            ArrayList<String> gROUPIDm = getBeanGROUPID(queZQBean);
            //进行分组
            int sizess = gROUPIDm.size();
            for (int s = 0; s < sizess; s++) {
                EZqBean eZqBean = new EZqBean();
                eZqBean.setGROUPID(gROUPIDm.get(s));
                List<EZqBean.PlantZqBean> zqBean = new ArrayList<>();
                for (int m = 0; m < size; m++) {
                    if (queZQBean.getV().getPLANS().get(m).getGROUPID().equals(gROUPIDm.get(s))) {
                        EZqBean.PlantZqBean plantZqBean = new EZqBean.PlantZqBean();
                        for (int ss = 0; ss < sebieSize; ss++) {
                            if (listFa.get(ss).getSYSTEMID() == queZQBean.getV().getPLANS().get(m).getSYSTEMID() && listFa.get(ss).getDEVID() == queZQBean.getV().getPLANS().get(m).getDEVID()) {
                                plantZqBean.setDevName(listFa.get(ss).getNAME());
                            }
                        }
                        plantZqBean.setStarttime(queZQBean.getV().getPLANS().get(m).getBEGINTIME());
                        plantZqBean.setEndtime(queZQBean.getV().getPLANS().get(m).getENDTIME());
                        plantZqBean.setEQPID(queZQBean.getV().getPLANS().get(m).getDEVID());
                        plantZqBean.setSc(queZQBean.getV().getPLANS().get(m).getDURATION());
                        plantZqBean.setZq(queZQBean.getV().getPLANS().get(m).getPEROID());
                        plantZqBean.setStatus(queZQBean.getV().getPLANS().get(m).getSTATUS());
                        plantZqBean.setCTRLID(queZQBean.getV().getPLANS().get(m).getDEVCTRLID());
                        plantZqBean.setSystemId(queZQBean.getV().getPLANS().get(m).getSYSTEMID());
                        zqBean.add(plantZqBean);
                    }
                }
                eZqBean.setZqBean(zqBean);
                eZqBeen.add(eZqBean);
            }
        }
        return eZqBeen;
    }

    /**
     * 自动遍历数据
     */
    public static List<EZdBean> getBeanZdBean(QueZDBean queZDBean, ArrayList<FaMenBean.VBean.STATUSBean> listFa) {
        List<EZdBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = queZDBean.getV().getPLANS().size();
        int sebieSize = listFa.size();
        LogUtils.e("除湿器数",sebieSize+"------");
        if (size != 0) {
            ArrayList<String> gROUPIDm = getZdBeanGROUPID(queZDBean);
            //进行分组
            int sizess = gROUPIDm.size();
            for (int s = 0; s < sizess; s++) {
                EZdBean eZqBean = new EZdBean();
                eZqBean.setGROUPID(gROUPIDm.get(s));
                List<EZdBean.PlantZqBean> zqBean = new ArrayList<>();
                for (int m = 0; m < size; m++) {
                    if (queZDBean.getV().getPLANS().get(m).getGROUPID().equals(gROUPIDm.get(s))) {
                        EZdBean.PlantZqBean plantZqBean = new EZdBean.PlantZqBean();
                        for (int ss = 0; ss < sebieSize; ss++) {
                            if (listFa.get(ss).getSYSTEMID() == queZDBean.getV().getPLANS().get(m).getSYSTEMID() && listFa.get(ss).getDEVID() == queZDBean.getV().getPLANS().get(m).getDEVID()) {
                                plantZqBean.setDevName(listFa.get(ss).getNAME());
                            }
                        }
                        plantZqBean.setCTRLID(queZDBean.getV().getPLANS().get(m).getDEVCTRLID());
                        plantZqBean.setSc(queZDBean.getV().getPLANS().get(m).getDURATION());
                        plantZqBean.setMaxSd((int) queZDBean.getV().getPLANS().get(m).getHUMIDITYMAX());
                        plantZqBean.setMinSd((int) queZDBean.getV().getPLANS().get(m).getHUMIDITYMIN());
                        plantZqBean.setEQPID(queZDBean.getV().getPLANS().get(m).getDEVID());
                        plantZqBean.setStatus(queZDBean.getV().getPLANS().get(m).getSTATUS());
                        plantZqBean.setSystemId(queZDBean.getV().getPLANS().get(m).getSYSTEMID());
                        zqBean.add(plantZqBean);
                    }
                }
                eZqBean.setZqBean(zqBean);
                eZqBeen.add(eZqBean);
            }
        }
        return eZqBeen;
    }

    /**
     * 周期遍历数据
     */
    public static List<EZqBean> getArrayZqBean(ArrayList<FameZqBean> arrayList) {
        List<EZqBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = arrayList.size();
        if (size != 0) {
            ArrayList<String> gROUPIDm = getArrayGROUPID(arrayList);
            //进行分组
            int sizess = gROUPIDm.size();
            for (int s = 0; s < sizess; s++) {
                EZqBean eZqBean = new EZqBean();
                eZqBean.setGROUPID(gROUPIDm.get(s));
                List<EZqBean.PlantZqBean> zqBean = new ArrayList<>();
                for (int m = 0; m < size; m++) {
                    if ((arrayList.get(m).getGROUPID() + "").equals(gROUPIDm.get(s))) {
                        EZqBean.PlantZqBean plantZqBean = new EZqBean.PlantZqBean();
                        plantZqBean.setDevName(arrayList.get(m).getDevName());
                        plantZqBean.setStarttime(arrayList.get(m).getStarttime());
                        plantZqBean.setEndtime(arrayList.get(m).getEndtime());
                        plantZqBean.setEQPID(arrayList.get(m).getEQPID());
                        plantZqBean.setSc(arrayList.get(m).getSc());
                        plantZqBean.setZq(arrayList.get(m).getZq());
                        plantZqBean.setStatus(0);
                        plantZqBean.setCTRLID(arrayList.get(m).getCTRLID());
                        plantZqBean.setSystemId(arrayList.get(m).getSystemId());
                        zqBean.add(plantZqBean);
                    }
                }
                eZqBean.setZqBean(zqBean);
                eZqBeen.add(eZqBean);
            }
        }
        return eZqBeen;
    }

    /**
     * 自动遍历数据
     */
    public static List<EZdBean> getArrayZdBean(ArrayList<FameZqBean> arrayList) {
        List<EZdBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = arrayList.size();
        if (size != 0) {
            ArrayList<String> gROUPIDm = getArrayGROUPID(arrayList);
            //进行分组
            int sizess = gROUPIDm.size();
            for (int s = 0; s < sizess; s++) {
                EZdBean eZqBean = new EZdBean();
                eZqBean.setGROUPID(gROUPIDm.get(s));
                List<EZdBean.PlantZqBean> zqBean = new ArrayList<>();
                for (int m = 0; m < size; m++) {
                    if ((arrayList.get(m).getGROUPID() + "").equals(gROUPIDm.get(s))) {
                        EZdBean.PlantZqBean plantZqBean = new EZdBean.PlantZqBean();
                        plantZqBean.setDevName(arrayList.get(m).getDevName());
                        plantZqBean.setEQPID(arrayList.get(m).getEQPID());
                        plantZqBean.setSc(arrayList.get(m).getSc());
                        plantZqBean.setMaxSd(arrayList.get(m).getMaxSd());
                        plantZqBean.setMinSd(arrayList.get(m).getMinSd());
                        plantZqBean.setStatus(0);
                        plantZqBean.setCTRLID(arrayList.get(m).getCTRLID());
                        plantZqBean.setSystemId(arrayList.get(m).getSystemId());
                        zqBean.add(plantZqBean);
                    }
                }
                eZqBean.setZqBean(zqBean);
                eZqBeen.add(eZqBean);
            }
        }
        return eZqBeen;
    }

    /**
     * 自动数据里面的东西
     */
    public static List<EZdBean> updateZdALLBean(List<EZdBean> arrayList, int min, int max, int sc, int postion) {
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            if (i == postion) {
                int sizess = arrayList.get(postion).getZqBean().size();
                for (int m = 0; m < sizess; m++) {
                    arrayList.get(postion).getZqBean().get(m).setSc(sc);
                    arrayList.get(postion).getZqBean().get(m).setMinSd(min);
                    arrayList.get(postion).getZqBean().get(m).setMaxSd(max);
                }
            }
        }
        return arrayList;
    }

    /**
     * 遍历数据里面的东西
     */
    public static List<EZqBean> updateZqALLBean(List<EZqBean> arrayList, int sc, int zq, int postion) {
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            if (i == postion) {
                int sizess = arrayList.get(postion).getZqBean().size();
                for (int m = 0; m < sizess; m++) {
                    arrayList.get(postion).getZqBean().get(m).setSc(sc);
                    arrayList.get(postion).getZqBean().get(m).setZq(zq);
                }
            }
        }
        return arrayList;
    }

    /**
     * 遍历数据里面的东西
     */
    public static List<EZqBean> updateZqBean(List<EZqBean> arrayList, String startTime, String endTime, int sc, int zq, int postion) {
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            if (i == postion) {
                int sizess = arrayList.get(postion).getZqBean().size();
                for (int m = 0; m < sizess; m++) {
                    arrayList.get(postion).getZqBean().get(m).setStarttime(startTime);
                    arrayList.get(postion).getZqBean().get(m).setEndtime(endTime);
                    arrayList.get(postion).getZqBean().get(m).setSc(sc);
                    arrayList.get(postion).getZqBean().get(m).setZq(zq);
                }
            }
        }
        return arrayList;
    }

    /**
     * 系统配置获取所有的作物类型id
     */
    private static ArrayList<String> getPlantType(SystemConfigBean systemConfigBean) {
        ArrayList<String> gPlantType = new ArrayList<>();
        gPlantType.clear();
        int size = systemConfigBean.getV().getCROPSTEPALLINFOS().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                gPlantType.add(systemConfigBean.getV().getCROPSTEPALLINFOS().get(i).getPlantType() + "");
            }
        }
        return com.xianbeiying.app.ckgl.data.DataUtil.getRListData(gPlantType);
    }

    /**
     * 系统配置获取所有的作物id
     */
    private static ArrayList<String> getCropId(SystemConfigBean systemConfigBean) {
        ArrayList<String> gROUPID = new ArrayList<>();
        int size = systemConfigBean.getV().getCROPSTEPALLINFOS().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                gROUPID.add(systemConfigBean.getV().getCROPSTEPALLINFOS().get(i).getCropId() + "");
            }
        }
        return com.xianbeiying.app.ckgl.data.DataUtil.getRListData(gROUPID);
    }

    private static int getAllplant(SystemConfigBean systemConfigBean) {
        ArrayList<String> gROUPID = new ArrayList<>();
        int size = systemConfigBean.getV().getCROPSTEPALLINFOS().size();
        if (size != 0) {
            for (int i = 0; i < size; i++) {
                gROUPID.add(systemConfigBean.getV().getCROPSTEPALLINFOS().get(i).getCropId() + "");
            }
        }
        return 0;
    }

    //获取数据
    public static List<SysConfigBean> getSystemBean(SystemConfigBean systemConfigBean) {
        List<SysConfigBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = systemConfigBean.getV().getCROPSTEPALLINFOS().size();
        if (size != 0) {
            ArrayList<String> gROUPIDm = getCropId(systemConfigBean);
            //进行分组
            int sizess = gROUPIDm.size();
            for (int s = 0; s < sizess; s++) {
                SysConfigBean systemConfig = new SysConfigBean();
                systemConfig.setCropId(Integer.valueOf(gROUPIDm.get(s)));
                List<SysConfigBean.ConfigBean> configBeen = new ArrayList<>();
                int number = 0;
                for (int m = 0; m < size; m++) {
                    if (systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getCropId() == Integer.valueOf(gROUPIDm.get(s))) {
                        SysConfigBean.ConfigBean configBeanss = new SysConfigBean.ConfigBean();
                        configBeanss.setPlantName(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getCropName());
                        configBeanss.setPlantType(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getPlantType());
                        configBeanss.setRemark(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getRemark());
                        configBeanss.setStepColor(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepColor());
                        configBeanss.setStepDuration(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepDuration());
                        configBeanss.setStepId(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepId());
                        configBeanss.setStepName(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepName());
                        number = number + systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepDuration();
                        configBeen.add(configBeanss);
                    }
                }
                systemConfig.setNumber(number);
                systemConfig.setConfigBean(configBeen);
                eZqBeen.add(systemConfig);
            }
        }
        return eZqBeen;
    }

    public static List<SysConfigssBean> getSystemBeans(SystemConfigBean systemConfigBean) {
        List<SysConfigssBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = systemConfigBean.getV().getCROPSTEPALLINFOS().size();
        if (size != 0) {
            for (int s = 0; s < size; s++) {
                SysConfigssBean sysConfigssBean = new SysConfigssBean();
                sysConfigssBean.setCropId(systemConfigBean.getV().getCROPSTEPALLINFOS().get(s).getCropId());
                sysConfigssBean.setPlantType(systemConfigBean.getV().getCROPSTEPALLINFOS().get(s).getPlantType());
                eZqBeen.add(sysConfigssBean);
            }
        }
        return com.xianbeiying.app.ckgl.data.DataUtil.getDean(eZqBeen);
    }

    public static List<SysConfigBean> getSystemBeanmm(SystemConfigBean systemConfigBean) {
        List<SysConfigBean> eZqBeen = new ArrayList<>();
        eZqBeen.clear();
        int size = systemConfigBean.getV().getCROPSTEPALLINFOS().size();
        if (size != 0) {
            List<SysConfigssBean> gROUPIDm = getSystemBeans(systemConfigBean);
            //进行分组
            int sizess = gROUPIDm.size();
            for (int s = 0; s < sizess; s++) {
                SysConfigBean systemConfig = new SysConfigBean();
                systemConfig.setCropId(gROUPIDm.get(s).getCropId());
                systemConfig.setPlantType(gROUPIDm.get(s).getPlantType());
                List<SysConfigBean.ConfigBean> configBeen = new ArrayList<>();
                int number = 0;
                for (int m = 0; m < size; m++) {
                    if (systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getCropId() == gROUPIDm.get(s).getCropId() &&
                            systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getPlantType() == gROUPIDm.get(s).getPlantType()) {
                        SysConfigBean.ConfigBean configBeanss = new SysConfigBean.ConfigBean();
                        configBeanss.setCropType(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getCropType());
                        configBeanss.setPlantName(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getCropName());
                        configBeanss.setPlantType(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getPlantType());
                        configBeanss.setRemark(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getRemark());
                        configBeanss.setStepColor(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepColor());
                        configBeanss.setStepDuration(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepDuration());
                        configBeanss.setStepId(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepId());
                        configBeanss.setStepName(systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepName());
                        number = number + systemConfigBean.getV().getCROPSTEPALLINFOS().get(m).getStepDuration();
                        configBeen.add(configBeanss);
                    }
                }
                systemConfig.setNumber(number);
                systemConfig.setConfigBean(configBeen);
                eZqBeen.add(systemConfig);
            }
        }
        return eZqBeen;
    }

    public static boolean isScHl(String starttime, String enttime, String etsc) {
        boolean issc = true;
        int chaTime = Integer.valueOf(DataUtil.getHHLongss(starttime, enttime));
        int sc;
        if (chaTime == 0) {
            //一天之内的
            sc = Integer.valueOf(com.xianbeiying.app.ckgl.util.DataUtil.getSLong(starttime, enttime));
        } else {
            //一天之外的
            sc = Integer.valueOf(com.xianbeiying.app.ckgl.util.DataUtil.getSLong(starttime, DataUtil.dateTime() + "  23:59"));
        }
        if (Integer.valueOf(etsc) > sc) {
            issc = false;
        } else {
            issc = true;
        }
        return issc;
    }

    public static boolean isZqHl(String starttime, String enttime, String etzq) {
        boolean issc = true;
        int chaTime = Integer.valueOf(DataUtil.getHHLongss(starttime, enttime));
        if (chaTime == 0) {
            //一天之内的
            chaTime = 1;
        }
        if (Integer.valueOf(etzq) > chaTime) {
            issc = false;
        } else {
            issc = true;
        }
        return issc;
    }
}
